package org.aspire.core;

import org.aspire.core.sys.GameException;

/******************************************************************************
 * Aspire2D uses a Game-Console-Engine architecture at its core. The Console
 * component is responsible for providing encapsulation of the Engine (to avoid
 * serious problems during runtime) from the Game. It is also responsible for
 * initializing the various components and subsystems of the Engine depending
 * on the computing environment or platform the 2D game is running.
 * <p>
 * Console is an interface that is implemented by system-dependent game loaders
 * since Aspire2D aims to provide cross-platform development library. For
 * example, a console for PC will implement the initialization of the engine
 * specific to the resources provided by a PC (like OpenGL for display).
 * 
 * @author JPACarabuena
 *****************************************************************************/
public interface Console {

	// ========================================================================
	// Final Fields
	// ========================================================================
	
	/**************************************************************************
	 * The engine to be used by this console to process any game.
	 *************************************************************************/
	public Engine ENGINE = Engine.getInstance();
	
	// ========================================================================
	// Getters & Setters
	// ========================================================================
	
	// ========================================================================
	// Override Methods
	// ========================================================================
	
	// ========================================================================
	// Methods
	// ========================================================================
	
	/**************************************************************************
	 * Mounts the game into the engine. This allows the engine to process the
	 * game to the main loop once it (the engine) is started. It might throw
	 * an exception due to mismatch of game target platform or platform version
	 * inconsistency.
	 * 
	 * @param game	the game that will be loaded to the engine.
	 * @throws GameException an exception triggered by failed game validation.
	 *************************************************************************/
	public void setup(Game game) throws GameException;
	
	/**************************************************************************
	 * Initialize and starts the game engine.
	 * 
	 * @throws GameException 
	 * 				an exception triggered when engine starts without a game
	 * 				to process.
	 *************************************************************************/
	public void start() throws GameException;
	
	/**************************************************************************
	 * Pause the processing of game engine due to lost focus.
	 *************************************************************************/
	public void pause();
	
	/**************************************************************************
	 * Resumes the processing of game engine. This is usually called after
	 * pausing the game. 
	 *************************************************************************/
	public void resume();
	
	/**************************************************************************
	 * Stops the processing of the game engine.
	 *************************************************************************/
	public void stop();
	
	/**************************************************************************
	 * Loads all the necessary and enabled engine subsystem.
	 * 
	 * @param	game	the game that is mounted in the engine.
	 *************************************************************************/
	public void loadSubSystems(Game game);
	
	// ========================================================================
	// Inner & Anonymous Classes
	// ========================================================================
}